home *** CD-ROM | disk | FTP | other *** search
- Path: xanth!nic.MR.NET!hal!ncoast!allbery
- From: creps@silver.bacs.indiana.edu (Steve Creps)
- Newsgroups: comp.sources.misc
- Subject: v05i023: PCcurses version 1.3, part 1/5
- Message-ID: <2565@silver.bacs.indiana.edu>
- Date: 31 Oct 88 02:49:11 GMT
- Sender: allbery@ncoast.UUCP
- Reply-To: creps@silver.bacs.indiana.edu (Steve Creps)
- Organization: IU CS Dept
- Lines: 1633
- Approved: allbery@ncoast.UUCP
-
- Posting-number: Volume 5, Issue 23
- Submitted-by: "Steve Creps" <creps@silver.bacs.indiana.edu>
- Archive-name: pc-curses-1.3/Part1
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 5)."
- # Contents: README.NOW beep.c border.c charpick.c curses.cmd endwin.c
- # farcall.inc hugedata.inc initscr.c longname.c move.c mvcursor.c
- # nearcall.inc scrreg.c smaldata.inc stradd.c tabsize.c termmisc.c
- # unctrl.c winclear.c windel.c winerase.c winmove.c winscrol.c
- # wintouch.c
- # Wrapped by creps@silver on Fri Oct 28 17:43:05 1988
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'README.NOW' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README.NOW'\"
- else
- echo shar: Extracting \"'README.NOW'\" \(12183 characters\)
- sed "s/^X//" >'README.NOW' <<'END_OF_FILE'
- X PCCURSES v.1.3 Release Notes - 881005
- X ===================================================
- X
- X This is the release note for the fourth version of PCcurses, v.1.3.
- XBelow this note, the release notes for v.1.0, v.1.1 and v.1.2 are in-
- Xcluded. Read those first.
- X
- X The file 'border.c' is now included. It allows you to explicitely speci-
- Xfy what characters should be used as box borders when the box() functions
- Xare called. If the new border characters are non-0, they override the bor-
- Xder characters specified in the box() call. In my understanding, this func-
- Xtionality is required for AT&T UNNIX sV.3 compatibility. Thanks for this
- Xgoes to Tony L. Hansen (hansen@pegasus.UUCP) for posting an article about
- Xit on UseNet (newsgrou comp.unix.questions; the posting was not related at
- Xall to PCcurses).
- X
- X The only other difference between v.1.2 and v.1.3 is that the latter has
- Xbeen changed to avoid warning diagnostics if the source files are compiled
- Xwith warning switches on (for MicroSoft this means '-W3', for Turbo'C' it
- Xmeans '-w -w-pro'). Of these, the Turbo'C' warning check is clearly to be
- Xused rather than MicroSoft, even if neither of them comes even close to a
- Xreal UNIX 'lint'. Some of the warnings in fact indicated real bugs, mostly
- Xfunctions that did not return correct return values or types.
- X
- X The makefiles for both MSC and TRC have been modified to produce warning
- Xmessages as part of normal compilation.
- X
- X
- X
- X
- X PCCURSES v.1.2 Release Notes - 881002
- X ===================================================
- X
- X This is the release note for the third version of PCcurses, v.1.2.
- XBelow this note, the release notes for v.1.0 and v.1.1 are included. Read
- Xthose first.
- X
- X The changes from v.1.1 to v.1.2 are minor. The biggest change is that there
- Xwas a bug related to limiting the cursor movement if the application tried to
- Xmove it outside the screen (something that should not be done anyway). Such
- Xerronous application behaviour is now handled correctly.
- X
- X All modules have been changed to have a revison string in them, which makes
- Xit easier to determine what version is linked into a program (or what library
- Xversion you have).
- X
- X There is now a 'cursesio.c' file. That file does the same as 'cursesio.asm'
- X(i.e. it provides the interface to the lower-level system I/O routines). It
- Xis written in 'C' and thus it is (possibly) more portable than the assembler
- Xversion (but still not so portable since it uses 8086 INT XX calls directly).
- XWhen one creates new curses libraries, one chooses whether to use the assem-
- Xbler or the 'C' version of cursesio. The choice is made by commenting out the
- Xappropriate dependencies for cursesio.obj, near the end of the makefiles.
- X
- X There is now a 'setmode.c' file. That file contains functions that save and
- Xrestore terminal modes. They do it into other variables than do savetty() and
- Xresetty(), so one should probably use either savetty()/resetty() or the new
- Xfunctions only - and not mix the both ways unless one really knows what one
- Xdoes.
- X
- X Diff lists vs v.1.0 are no longer included in the distribution. The make
- Xutility still is. PCcurses v.1.2 still compiles with MicroSoft 'C' v.4.0,
- Xand with Borland Turbo 'C' v.1.0. There is as far as I know no reason to be-
- Xlieve that it does not compile under MicroSoft 'C' v.3.0 and 5.x, or Turbo-
- X'C' v.1.5, but this has not been tested.
- X
- X There are two makefile's included, one for MicroSoft 'C', one for Turbo-'C'.
- XThey are both copies of my personal makefile's, and as such they reflect the
- Xdirectory structure on my own computer. This will have to be changed before
- Xyou run make. Check $(INCDIR) and $(LIBDIR) in particular, and make the choice
- Xof ASM or 'C' cursesio version as mentioned above (the distribution version
- Xuses the 'C version of cursesio).
- X
- X The manual file (curses.man) has been changed at appropriate places.
- X
- X I would like to thank the following persons for their help:
- X
- X Brandon S. Allbery (alberry@ncoast.UUCP)
- X for running comp.binaries.ibm.pc (at that time)
- X and comp.source.misc.
- X
- X Steve Balogh (Steve@cit5.cit.oz.AU)
- X for writing a set of manual pages and posting
- X them to the net.
- X
- X Torbjorn Lindh
- X for finding bugs and suggesting raw
- X character output routines.
- X
- X Nathan Glasser (nathan@eddie.mit.edu)
- X for finding and reporting bugs.
- X
- X Ingvar Olafsson (...enea!hafro!ingvar)
- X for finding and reporting bugs.
- X
- X Eric Rosco (...enea!ipmoea!ericr)
- X for finding and reporting bugs.
- X
- X Steve Creps (creps@silver.bacs.indiana.edu)
- X for doing a lot of work - among others
- X posting bug fixes to the net, and writing
- X the new cursesio.c module.
- X
- X N. Dean Pentcheff (dean@violet.berkeley.edu)
- X for finding bugs and rewriting cursesio.asm
- X for Turbo 'C' 1.5.
- X
- X Finally, Jeff Dean (parcvax,hplabs}!cdp!jeff)
- X (jeff@ads.arpa)
- X has had a shareware version of curses deliverable since
- X about half a year before I released PCcurses 1.0 on Use-
- X Net. He is very concerned about confusion between the two
- X packages, and therefore any references on the network
- X should make clear whether they reference Dean's PCcurses
- X or Larsson's PCcurses.
- X
- X PCCURSES v.1.1 Release Notes - 880306
- X ===================================================
- X
- X This is the release note for the second version of PCcurses, v.1.1.
- XBelow this note, the release note for v.1.0 is included. Read that first.
- XThe changes from v.1.0 to v.1.1 are minor. There are a few bug fixes, and
- Xnew (non-portable) functions for verbatim IBM character font display have
- Xbeen added (in charadd.c and charins.c). The manual file (curses.man) has
- Xbeen changed at appropriate places.
- X
- X In the file v10tov11.dif there are listings of the differencies between
- Xversion 1.0 and 1.1. The diff listings are in UNIX diff(1) format.
- X
- X Version 1.1 compiles with Turbo 'C' v.1.0, as well as MicroSoft 'C' v.3.0
- Xand v.4.0. On the release disk there is a make.exe utility which is very simi-
- Xlar to UNIX make (If the package was mailed to you, the make utility will be
- Xin uuencoded format - in make.uu - and must be uudecoded first). It is much
- Xmore powerful than MicroSoft's different MAKE'S; the latter ones will NOT ge-
- Xnerate libraries properly if used with the PCcurses makefiles.
- X
- X There are three makefiles:
- X
- X makefile generic MSC 3.0 makefile
- X makefile.ms MSC 4.0 makefile
- X makefile.tc Turbo 'C' 1.0 makefile
- X
- X To make a library with for example Turbo 'C', make directories to hold .H
- Xand .LIB files (these directories are the 'standard places'), edit makefile.tc
- Xfor this, and type
- X
- X make -f makefile.tc all
- X
- Xand libraries for all memory models will be created in the .LIB directory,
- Xwhile the include files will end up in the .H directory. Also read what is
- Xsaid about installation below!
- X
- X
- X
- X
- X PCCURSES v.1.0 Release Notes - 870824
- X ===================================================
- X
- X
- X
- X This is the release notes for the PCcurses v.1.0 cursor/window control
- Xpackage. PCcurses offers the functionality of UNIX curses, plus some
- Xextras. Normally it should be possible to port curses-based programs from
- XUNIX curses to PCcurses on the IBM PC without changes. PCcurses is a port/
- Xrewrite of Pavel Curtis' public domain 'ncurses' package. All the code has
- Xbeen re-written - it is not just an edit of ncurses (or UNIX curses). I
- Xmention this to clarify any copyright violation claims. The data struc-
- Xtures and ideas are very similar to ncurses. As for UNIX curses, I have
- Xnot even seen any sources for it.
- X
- X For an introduction to the use of 'curses' and it's derivatives, you
- Xshould read 'Screen Updating and Cursor Movement Optimization: A Library
- XPackage' by Kenneth C. R. C. Arnold, which describes the original Berkely
- XUNIX version of curses. It is available as part of the UNIX manuals. The
- Xother source of information is 'The Ncurses Reference Manual' by Pavel
- XCurtis. The latter is part of Curtis' ncurses package.
- X
- X The only other documentation provided is a 'man' page which describes
- Xall the included functions in a very terse way. In the sources, each
- Xfunction is preceded by a rather thourough description of what the
- Xfunction does. I didn't have time to write a nice manual/tutorial - sorry.
- X
- X PCcurses is released as a number of source files, a man page, and a make
- Xfile. A uuencoded copy of a 'make' utility, and a manpage for the 'make' is
- Xalso provided to make it easier to put together PCcurses libraries. Even if
- Xyou are not interested in PCcurses, it may be worthwhile to grab the make.
- X
- X The makefile assumes the presence of the MicroSoft 'C' compiler (3.0 or
- X4.0), MicroSoft MASM and LIB, plus some MS-DOS utilities. The reason for
- Xsupplying MAKE.EXE is that the MicroSoft 'MAKE:s' are much inferior to a
- Xreal UNIX make. The supplied make is a port of a public domain make, pub-
- Xlished on UseNet. It is almost completely compatible with UNIX make. When
- Xgenerating the curses libraries, the makefile will direct make to do some
- Xdirectory creating and file copying, and then re-invoke itself with new
- Xtargets. The workings of the makefile are not absolutely crystal clear at
- Xfirst sight... just start it and see what it does.
- X
- X For portability, the curses libraries depend on one assembler file for
- Xaccess to the BIOS routines. There is no support for the EGA, but both
- XCGA, MGA, and the HGA can be used. The libraries are originally for Micro-
- XSoft 'C', but all C modules should be portable right away. In the assembler
- Xfile, segment names probably need to be changed, and possibly the parameter
- Xpassing scheme. I think Turbo C will work right away - as far as I under-
- Xstand, all it's conventions are compatible with MicroSoft C.
- X
- X There are some parts left out between ncurses and PCcurses. One is the
- Xsupport for multiple terminals - not very interesting on a PC anyway. Be-
- Xcause we KNOW what terminal we have, there is no need for a termcap or
- Xtermio library. PCcurses also has some things that neither curses nor
- Xncurses have. Compared to the original UNIX curses, PCcurses has lots
- Xof extras.
- X
- X The BIOS routines are used directly, which gives fast screen updates.
- XPCcurses does not do direct writes to screen RAM - in my opinion it is
- Xa bit ugly to rely that much on hardware compatibility. Anyone could fix
- Xthat, of course...
- X
- X One of the more serious problems with PCcurses is the way in which nor-
- Xmal, cbreak, and raw input modes are done. All those details are in the
- X'charget' module - I do raw I/O via the BIOS, and perform any buffering
- Xmyself. If an application program uses PCcurses, it should do ALL it's
- XI/O via PCcurses calls, otherwise the mix of normal and PCcurses I/O may
- Xmess up the display. I think my code is reasonable... comments are welcome,
- Xprovided you express them nicely...
- X
- X To install, copy all files to a work directory, edit 'makefile' to define
- Xthe standard include and library file directory names of your choice (these
- Xdirectories must exist already, and their path names must be relative to the
- Xroot directory, not to the current one). You must also run uudecode on
- Xmake.uu, to generate MAKE.EXE. You can do that on your PC, if you have
- Xuudecode there, otherwise you can do it under UNIX and do a binary transfer
- Xto the PC. When you have MAKE.EXE in your work directory (or in your /bin
- Xdirectory), type make.
- X
- X Make will now create 4 sub-directories (one for each memory model), copy
- Xsome assembler include files into them, copy two include files to your
- Xinclude directory, CHDIR to each sub-directory and re-invoke itself with
- Xother make targets to compile and assemble all the source files into the
- Xappropriate directories. Then the library manager is run to create the
- Xlibrary files in your desired library directory. Presto!
- X
- X If you only want to generate a library for one memory model, type 'make
- Xsmall', 'make large', etc. The name of the memory model must be in lower
- Xcase, like in the makefile.
- X
- X I think the package is fairly well debugged - but then again, that's
- Xwhat I always think. It was completed in May-87, and no problems found
- Xyet. Now it's your turn... Comments, suggestions and bug reports and
- Xfixes (no flames please) to
- X
- XBjorn Larsson
- XINFOVOX AB
- XBox 2503 (...seismo!mcvax!enea!infovax!bl)
- XS-171 02 Solna
- XSWEDEN
- END_OF_FILE
- if test 12183 -ne `wc -c <'README.NOW'`; then
- echo shar: \"'README.NOW'\" unpacked with wrong size!
- fi
- # end of 'README.NOW'
- fi
- if test -f 'beep.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'beep.c'\"
- else
- echo shar: Extracting \"'beep.c'\" \(1500 characters\)
- sed "s/^X//" >'beep.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* */
- X/* Beep() and flash() routines of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_beep_rcsid[] = "@(#)beep.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Beep() sounds the terminal bell. */
- X/****************************************************************/
- X
- Xvoid beep()
- X {
- X _cursesputc('\007',0);
- X } /* beep */
- X
- X/****************************************************************/
- X/* Flash() flashes the terminal screen. */
- X/****************************************************************/
- X
- Xvoid flash()
- X {
- X int i;
- X
- X _cursesscroll(0,0,LINES-1,COLS-1,0,0x70);
- X for (i=0;i<10000;)
- X i++;
- X _cursesscroll(0,0,LINES-1,COLS-1,0,0x0);
- X wrefresh(curscr);
- X } /* flash */
- END_OF_FILE
- if test 1500 -ne `wc -c <'beep.c'`; then
- echo shar: \"'beep.c'\" unpacked with wrong size!
- fi
- # end of 'beep.c'
- fi
- if test -f 'border.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'border.c'\"
- else
- echo shar: Extracting \"'border.c'\" \(2207 characters\)
- sed "s/^X//" >'border.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Box border control routines of the PCcurses package. */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.3: Released: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_border_rcsid[] = "@(#)border.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Wborder() sets the border characters in window win. */
- X/****************************************************************/
- X
- Xvoid wborder(win, l, r, t, b, tl, tr, bl, br)
- X WINDOW *win;
- X int l;
- X int r;
- X int t;
- X int b;
- X int tl;
- X int tr;
- X int bl;
- X int br;
- X {
- X win->_borderchars[0] = (char) l;
- X win->_borderchars[1] = (char) r;
- X win->_borderchars[2] = (char) t;
- X win->_borderchars[3] = (char) b;
- X win->_borderchars[4] = (char) tl;
- X win->_borderchars[5] = (char) tr;
- X win->_borderchars[6] = (char) bl;
- X win->_borderchars[7] = (char) br;
- X } /* wborder */
- X
- X/****************************************************************/
- X/* Border() sets the border characters in the stdscr window. */
- X/* Don't make this a call to wborder() - it would require soo */
- X/* much stack for parameters... */
- X/****************************************************************/
- X
- Xvoid border(l, r, t, b, tl, tr, bl, br)
- X int l;
- X int r;
- X int t;
- X int b;
- X int tl;
- X int tr;
- X int bl;
- X int br;
- X {
- X stdscr->_borderchars[0] = (char) l;
- X stdscr->_borderchars[1] = (char) r;
- X stdscr->_borderchars[2] = (char) t;
- X stdscr->_borderchars[3] = (char) b;
- X stdscr->_borderchars[4] = (char) tl;
- X stdscr->_borderchars[5] = (char) tr;
- X stdscr->_borderchars[6] = (char) bl;
- X stdscr->_borderchars[7] = (char) br;
- X } /* border */
- END_OF_FILE
- if test 2207 -ne `wc -c <'border.c'`; then
- echo shar: \"'border.c'\" unpacked with wrong size!
- fi
- # end of 'border.c'
- fi
- if test -f 'charpick.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'charpick.c'\"
- else
- echo shar: Extracting \"'charpick.c'\" \(2393 characters\)
- sed "s/^X//" >'charpick.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Winch() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_charpick_rcsid[] = "@(#)charpick.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Winch(win) returns the character at the current position in */
- X/* window 'win'. */
- X/****************************************************************/
- X
- Xint winch(win)
- X WINDOW *win;
- X {
- X return((win->_line[win->_cury][win->_curx]) & 0xff);
- X } /* winch */
- X
- X/****************************************************************/
- X/* Inch() returns the character at the current cursor position */
- X/* in stdscr. */
- X/****************************************************************/
- X
- Xint inch()
- X {
- X return((stdscr->_line[stdscr->_cury][stdscr->_curx]) & 0xff);
- X } /* inch */
- X
- X/****************************************************************/
- X/* Mvinch() moves the stdscr cursor to a new position, then */
- X/* returns the character at that position. */
- X/****************************************************************/
- X
- Xint mvinch(y,x)
- X int y;
- X int x;
- X {
- X if (wmove(stdscr,y,x) == ERR)
- X return(ERR);
- X return((stdscr->_line[stdscr->_cury][stdscr->_curx]) & 0xff);
- X } /* mvinch */
- X
- X/****************************************************************/
- X/* Mvwinch() moves the cursor of window 'win' to a new posi- */
- X/* tion, then returns the character at that position. */
- X/****************************************************************/
- X
- Xint mvwinch(win,y,x)
- X WINDOW *win;
- X int y;
- X int x;
- X {
- X if (wmove(win,y,x) == ERR)
- X return(ERR);
- X return((win->_line[win->_cury][win->_curx]) & 0xff);
- X } /* mvwinch */
- END_OF_FILE
- if test 2393 -ne `wc -c <'charpick.c'`; then
- echo shar: \"'charpick.c'\" unpacked with wrong size!
- fi
- # end of 'charpick.c'
- fi
- if test -f 'curses.cmd' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'curses.cmd'\"
- else
- echo shar: Extracting \"'curses.cmd'\" \(632 characters\)
- sed "s/^X//" >'curses.cmd' <<'END_OF_FILE'
- Xtmp
- Xy
- Xattrib.obj &
- X+beep.obj &
- X+border.obj &
- X+boxes.obj &
- X+charadd.obj &
- X+chardel.obj &
- X+charget.obj &
- X+charins.obj &
- X+charpick.obj &
- X+clrtobot.obj &
- X+clrtoeol.obj &
- X+cursesio.obj &
- X+endwin.obj &
- X+initscr.obj &
- X+linedel.obj &
- X+lineins.obj &
- X+longname.obj &
- X+move.obj &
- X+mvcursor &
- X+newwin.obj &
- X+options.obj &
- X+overlay.obj &
- X+prntscan.obj &
- X+refresh.obj &
- X+scrreg.obj &
- X+setmode.obj &
- X+setterm.obj &
- X+stradd.obj &
- X+strget.obj &
- X+tabsize.obj &
- X+termmisc.obj &
- X+unctrl.obj &
- X+update.obj &
- X+winclear.obj &
- X+windel.obj &
- X+winerase.obj &
- X+winmove.obj &
- X+winscrol.obj &
- X+wintouch.obj
- Xnul
- END_OF_FILE
- if test 632 -ne `wc -c <'curses.cmd'`; then
- echo shar: \"'curses.cmd'\" unpacked with wrong size!
- fi
- # end of 'curses.cmd'
- fi
- if test -f 'endwin.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'endwin.c'\"
- else
- echo shar: Extracting \"'endwin.c'\" \(1514 characters\)
- sed "s/^X//" >'endwin.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Endwin() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Changed call sequence to cursesio.[c,asm], Thanks */
- X/* to S. Creps. Rcsid[] string for maintenance: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_endwin_rcsid[] = "@(#)endwin.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Endwin() does necessary clean-up after using the PCcurses */
- X/* package. It should be called before exiting the user's pro- */
- X/* gram. */
- X/****************************************************************/
- X
- Xint endwin()
- X {
- X delwin(stdscr);
- X delwin(curscr);
- X delwin(_cursvar.tmpwin);
- X curson(); /* turn on cursor if off */
- X _cursescursor(LINES-1, 0); /* put at lower left */
- X _cursesscb(_cursvar.orgcbr); /* restore original ^BREAK setting */
- X return(OK);
- X } /* endwin */
- END_OF_FILE
- if test 1514 -ne `wc -c <'endwin.c'`; then
- echo shar: \"'endwin.c'\" unpacked with wrong size!
- fi
- # end of 'endwin.c'
- fi
- if test -f 'farcall.inc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'farcall.inc'\"
- else
- echo shar: Extracting \"'farcall.inc'\" \(16 characters\)
- sed "s/^X//" >'farcall.inc' <<'END_OF_FILE'
- X far_call EQU 1
- END_OF_FILE
- if test 16 -ne `wc -c <'farcall.inc'`; then
- echo shar: \"'farcall.inc'\" unpacked with wrong size!
- fi
- # end of 'farcall.inc'
- fi
- if test -f 'hugedata.inc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'hugedata.inc'\"
- else
- echo shar: Extracting \"'hugedata.inc'\" \(17 characters\)
- sed "s/^X//" >'hugedata.inc' <<'END_OF_FILE'
- X huge_data EQU 1
- END_OF_FILE
- if test 17 -ne `wc -c <'hugedata.inc'`; then
- echo shar: \"'hugedata.inc'\" unpacked with wrong size!
- fi
- # end of 'hugedata.inc'
- fi
- if test -f 'initscr.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'initscr.c'\"
- else
- echo shar: Extracting \"'initscr.c'\" \(2346 characters\)
- sed "s/^X//" >'initscr.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Initscr() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.1: Revision string in the code: 880306 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_initscr_rcsid[] = "@(#)initscr.c v1.3 - 881005";
- Xchar _curses_revcod[] = CURSES_RCS_ID;
- Xchar _curses_cpyrgt[] = "Author B. Larsson - Public Domain";
- X
- Xextern void exit(); /* to avoid warings */
- X
- XWINDOW *curscr; /* the current screen image */
- XWINDOW *stdscr; /* the default screen window */
- Xcursv _cursvar; /* curses variables */
- Xint LINES; /* terminal height */
- Xint COLS; /* terminal width */
- X
- X/****************************************************************/
- X/* Initscr() does necessary initializations for the PCcurses */
- X/* package. It MUST be called before any other curses routines. */
- X/****************************************************************/
- X
- Xint initscr()
- X {
- X _cursvar.cursrow = -1; /* Initial cursor unknown */
- X _cursvar.curscol = -1;
- X _cursvar.autocr = TRUE; /* lf -> crlf by default */
- X _cursvar.raw = FALSE; /* tty I/O modes */
- X _cursvar.cbreak = FALSE;
- X _cursvar.echo = TRUE;
- X _cursvar.refrbrk = FALSE; /* no premature end of refresh */
- X _cursvar.orgcbr = (bool)_cursesgcb();/* original ^BREAK setting */
- X
- X LINES = 25; /* @@@@ this must be fixed */
- X COLS = _cursesgcols();
- X
- X if ((_cursvar.tmpwin = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
- X exit(1);
- X if ((curscr = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
- X exit(1);
- X if ((stdscr = newwin(LINES,COLS,0,0)) == (WINDOW *)ERR)
- X exit(1);
- X curscr->_clear = FALSE;
- X return(OK);
- X } /* initscr */
- END_OF_FILE
- if test 2346 -ne `wc -c <'initscr.c'`; then
- echo shar: \"'initscr.c'\" unpacked with wrong size!
- fi
- # end of 'initscr.c'
- fi
- if test -f 'longname.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'longname.c'\"
- else
- echo shar: Extracting \"'longname.c'\" \(1179 characters\)
- sed "s/^X//" >'longname.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Longname() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_longname_rcsid[] = "@(#)longname.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Longname() returns a pointer to a string describing the */
- X/* user terminal. */
- X/****************************************************************/
- X
- Xchar *longname()
- X {
- X return("IBM PC BIOS");
- X }/* longname */
- END_OF_FILE
- if test 1179 -ne `wc -c <'longname.c'`; then
- echo shar: \"'longname.c'\" unpacked with wrong size!
- fi
- # end of 'longname.c'
- fi
- if test -f 'move.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'move.c'\"
- else
- echo shar: Extracting \"'move.c'\" \(1591 characters\)
- sed "s/^X//" >'move.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Wmove() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Max limits off by 1. Fixed thanks to S. Creps: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_move_rcsid[] = "@(#)move.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Wmove() moves the cursor in window 'win' to position (x,y). */
- X/****************************************************************/
- X
- Xint wmove(win,y,x)
- X WINDOW *win;
- X int y;
- X int x;
- X {
- X if ((x < 0)||(x >= win->_maxx)||(y < win->_regtop)||(y > win->_regbottom))
- X return(ERR);
- X win->_curx = x;
- X win->_cury = y;
- X return(OK);
- X } /* wmove */
- X
- X/****************************************************************/
- X/* Move() moves the cursor in stdscr to position (x,y). */
- X/****************************************************************/
- X
- Xint move(y,x)
- X int y;
- X int x;
- X {
- X return(wmove(stdscr,y,x));
- X } /* move */
- END_OF_FILE
- if test 1591 -ne `wc -c <'move.c'`; then
- echo shar: \"'move.c'\" unpacked with wrong size!
- fi
- # end of 'move.c'
- fi
- if test -f 'mvcursor.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'mvcursor.c'\"
- else
- echo shar: Extracting \"'mvcursor.c'\" \(1439 characters\)
- sed "s/^X//" >'mvcursor.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Mvcur() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Changed call sequence to cursesio.[c,asm], Thanks */
- X/* to S. Creps. Rcsid[] string for maintenance: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_mvcursor_rcsid[] = "@(#)mvcursor.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Mvcur(oldy,oldx,newy,newx) the display cursor to <newy,newx> */
- X/****************************************************************/
- X
- Xint mvcur(oldy,oldx,newy,newx)
- X int oldy;
- X int oldx;
- X int newy;
- X int newx;
- X {
- X if ((newy >= LINES) || (newx >= COLS) || (newy < 0) || (newx < 0))
- X return(ERR);
- X _cursescursor(newy,newx);
- X _cursvar.cursrow = newy;
- X _cursvar.curscol = newx;
- X return(OK);
- X } /* mvcur */
- END_OF_FILE
- if test 1439 -ne `wc -c <'mvcursor.c'`; then
- echo shar: \"'mvcursor.c'\" unpacked with wrong size!
- fi
- # end of 'mvcursor.c'
- fi
- if test -f 'nearcall.inc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'nearcall.inc'\"
- else
- echo shar: Extracting \"'nearcall.inc'\" \(16 characters\)
- sed "s/^X//" >'nearcall.inc' <<'END_OF_FILE'
- X far_call EQU 0
- END_OF_FILE
- if test 16 -ne `wc -c <'nearcall.inc'`; then
- echo shar: \"'nearcall.inc'\" unpacked with wrong size!
- fi
- # end of 'nearcall.inc'
- fi
- if test -f 'scrreg.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'scrreg.c'\"
- else
- echo shar: Extracting \"'scrreg.c'\" \(1843 characters\)
- sed "s/^X//" >'scrreg.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Wsetscrreg() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Max limits off by 1. Fixed thanks to S. Creps: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_scrreg_rcsid[] = "@(#)scrreg.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Wsetscrreg() set the scrolling region of window 'win' to in- */
- X/* clude all lines between 'top' and 'bottom'. */
- X/****************************************************************/
- X
- Xint wsetscrreg(win, top, bottom)
- X WINDOW *win;
- X int top;
- X int bottom;
- X {
- X if ( (0 <= top)
- X &&
- X (top <= win->_cury)
- X &&
- X (win->_cury <= bottom)
- X &&
- X (bottom < win->_maxy)
- X )
- X {
- X win->_regtop = top;
- X win->_regbottom = bottom;
- X return(OK);
- X } /* if */
- X else
- X return(ERR);
- X } /* wsetscrreg */
- X
- X/****************************************************************/
- X/* Setscrreg() set the scrolling region of stdscr to include */
- X/* all lines between 'top' and 'bottom'. */
- X/****************************************************************/
- X
- Xint setscrreg(top, bottom)
- X int top;
- X int bottom;
- X {
- X return(wsetscrreg(stdscr,top,bottom));
- X } /* setscrreg */
- END_OF_FILE
- if test 1843 -ne `wc -c <'scrreg.c'`; then
- echo shar: \"'scrreg.c'\" unpacked with wrong size!
- fi
- # end of 'scrreg.c'
- fi
- if test -f 'smaldata.inc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'smaldata.inc'\"
- else
- echo shar: Extracting \"'smaldata.inc'\" \(17 characters\)
- sed "s/^X//" >'smaldata.inc' <<'END_OF_FILE'
- X huge_data EQU 0
- END_OF_FILE
- if test 17 -ne `wc -c <'smaldata.inc'`; then
- echo shar: \"'smaldata.inc'\" unpacked with wrong size!
- fi
- # end of 'smaldata.inc'
- fi
- if test -f 'stradd.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'stradd.c'\"
- else
- echo shar: Extracting \"'stradd.c'\" \(2666 characters\)
- sed "s/^X//" >'stradd.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Addstr() routines of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_stradd_rcsid[] = "@(#)stradd.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Waddstr() inserts string 'str' at the current cursor posi- */
- X/* tion in window 'win', and takes any actions as dictated by */
- X/* the characters. */
- X/****************************************************************/
- X
- Xint waddstr(win, str)
- X WINDOW *win;
- X char *str;
- X {
- X while (*str)
- X {
- X if (waddch(win, *str++) == ERR)
- X return(ERR);
- X }
- X return(OK);
- X } /* waddstr */
- X
- X/****************************************************************/
- X/* Addstr() inserts string 'str' at the current cursor posi- */
- X/* tion in stdscr, and takes any actions as dictated by the */
- X/* characters. */
- X/****************************************************************/
- X
- Xint addstr(str)
- X char *str;
- X {
- X return (waddstr(stdscr,str));
- X } /* addstr */
- X
- X/****************************************************************/
- X/* Mvaddstr() move to a new position in stdscr, then inserts */
- X/* string 'str' at the new position, taking any actions as dic- */
- X/* tated by the characters. */
- X/****************************************************************/
- X
- Xint mvaddstr(y,x,str)
- X int y;
- X int x;
- X char *str;
- X {
- X if (wmove(stdscr,y,x) == ERR)
- X return (ERR);
- X return (waddstr(stdscr,str));
- X } /* mvaddstr */
- X
- X/****************************************************************/
- X/* Mvwaddstr() move to a new position in window 'win', then */
- X/* inserts string 'str' at the new position, taking any actions */
- X/* as dictated by the characters. */
- X/****************************************************************/
- X
- Xint mvwaddstr(win,y,x,str)
- X WINDOW *win;
- X int y;
- X int x;
- X char *str;
- X {
- X if (wmove(win,y,x) == ERR)
- X return (ERR);
- X return (waddstr(win,str));
- X } /* mvwaddstr */
- END_OF_FILE
- if test 2666 -ne `wc -c <'stradd.c'`; then
- echo shar: \"'stradd.c'\" unpacked with wrong size!
- fi
- # end of 'stradd.c'
- fi
- if test -f 'tabsize.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'tabsize.c'\"
- else
- echo shar: Extracting \"'tabsize.c'\" \(1662 characters\)
- sed "s/^X//" >'tabsize.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Tabsize() routines of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_tabsize_rcsid[] = "@(#)tabsize.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Wtabsize(win,ts) sets the tabsize of window 'win' to 'ts', */
- X/* and returns the original value. */
- X/****************************************************************/
- X
- Xint wtabsize(win,ts)
- X WINDOW *win;
- X int ts;
- X {
- X int origval;
- X
- X origval = win->_tabsize;
- X win->_tabsize = ts;
- X return(origval);
- X } /* wtabsize*/
- X
- X/****************************************************************/
- X/* Tabsize(ts) sets the tabsize of stdscr to 'ts', and returns */
- X/* the original value. */
- X/****************************************************************/
- X
- Xint tabsize(ts)
- X int ts;
- X {
- X int origval;
- X
- X origval = stdscr->_tabsize;
- X stdscr->_tabsize = ts;
- X return(origval);
- X } /* tabsize */
- END_OF_FILE
- if test 1662 -ne `wc -c <'tabsize.c'`; then
- echo shar: \"'tabsize.c'\" unpacked with wrong size!
- fi
- # end of 'tabsize.c'
- fi
- if test -f 'termmisc.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'termmisc.c'\"
- else
- echo shar: Extracting \"'termmisc.c'\" \(2893 characters\)
- sed "s/^X//" >'termmisc.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Miscellaneous Terminal routines of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- X/* static variables or saving terminal modes */
- X
- Xchar _curses_termmisc_rcsid[] = "@(#)termmisc.c v1.3 - 881005";
- X
- Xstatic bool savedacr;
- Xstatic bool savedcbr;
- Xstatic bool savedecho;
- Xstatic bool savedraw;
- X
- X/****************************************************************/
- X/* Fixterm(), resetterm(), saveoldterm, saveterm() gettmode(), */
- X/* setterm() and baudrate() function dummies for compatibility. */
- X/****************************************************************/
- X
- Xint fixterm()
- X {
- X return(OK);
- X } /* fixterm */
- X
- Xint resetterm()
- X {
- X return(OK);
- X }
- X
- Xint saveoldterm()
- X {
- X return(OK);
- X } /* saveoldterm */
- X
- Xint saveterm()
- X {
- X return(OK);
- X } /* saveterm */
- X
- Xint gettmode()
- X {
- X return(OK);
- X } /* gettmode */
- X
- Xint setterm()
- X {
- X return(OK);
- X } /* setterm */
- X
- Xint baudrate()
- X {
- X return(19200);
- X } /* baudrate */
- X
- X/****************************************************************/
- X/* Erasechar(), killchar() returns std MSDOS erase chars. */
- X/****************************************************************/
- X
- Xint erasechar()
- X {
- X return(_DCCHAR); /* character delete char */
- X } /* erasechar */
- X
- Xint killchar()
- X {
- X return(_DLCHAR); /* line delete char */
- X } /* killchar */
- X
- X/****************************************************************/
- X/* Savetty() and resetty() saves and restores the terminal I/O */
- X/* settings. */
- X/****************************************************************/
- X
- Xint savetty()
- X {
- X savedacr = _cursvar.autocr;
- X savedcbr = _cursvar.cbreak;
- X savedecho = _cursvar.echo;
- X savedraw = _cursvar.raw;
- X return(OK);
- X } /* savetty */
- X
- Xint resetty()
- X {
- X _cursvar.autocr = savedacr;
- X _cursvar.cbreak = savedcbr;
- X _cursvar.echo = savedecho;
- X _cursvar.raw = savedraw;
- X return(OK);
- X } /* resetty */
- X
- X/****************************************************************/
- X/* Setupterm() sets up the terminal. On a PC, it is always suc- */
- X/* cessful, and returns 1. */
- X/****************************************************************/
- X
- Xint setupterm()
- X {
- X return(1);
- X } /* setupterm */
- END_OF_FILE
- if test 2893 -ne `wc -c <'termmisc.c'`; then
- echo shar: \"'termmisc.c'\" unpacked with wrong size!
- fi
- # end of 'termmisc.c'
- fi
- if test -f 'unctrl.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'unctrl.c'\"
- else
- echo shar: Extracting \"'unctrl.c'\" \(2116 characters\)
- sed "s/^X//" >'unctrl.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Unctrl() routines of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* IMPLEMENTATION NOTE */
- X/* The conversion from a control character to a two-character */
- X/* sequence is done by the unctrl() function. In the BSD ver- */
- X/* sion of curses it is done by a macro, which uses a publi- */
- X/* cally available translation table. Some ill-behaved appli- */
- X/* cation programs use the table directly, and since it does */
- X/* not exist in this curses version such application will link */
- X/* with an error message complainting about undefined symbols. */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xstatic char strbuf[3] = {0,0,0};
- X
- Xchar _curses_unctrl_rcsid[] = "@(#)unctrl.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Unctrl() returns a char pointer to a string corresponding to */
- X/* argument character 'c'. */
- X/****************************************************************/
- X
- Xchar *unctrl(c)
- X char c;
- X {
- X int ic = c;
- X ic &= 0xff;
- X
- X if ((ic >= ' ') && (ic != 0x7f)) /* normal characters */
- X {
- X strbuf[0] = (char) ic;
- X strbuf[1] = '\0';
- X return(strbuf);
- X } /* if */
- X strbuf[0] = '^'; /* '^' prefix */
- X if (c == 0x7f) /* DEL */
- X strbuf[1] = '?';
- X else /* other control */
- X strbuf[1] = ((char) ic) + '@';
- X return(strbuf);
- X } /* unctrl */
- END_OF_FILE
- if test 2116 -ne `wc -c <'unctrl.c'`; then
- echo shar: \"'unctrl.c'\" unpacked with wrong size!
- fi
- # end of 'unctrl.c'
- fi
- if test -f 'winclear.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'winclear.c'\"
- else
- echo shar: Extracting \"'winclear.c'\" \(1578 characters\)
- sed "s/^X//" >'winclear.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Clear() routines of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Rcsid[] string for maintenance: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_winclear_rcsid[] = "@(#)winclear.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Wclear() fills all lines of window 'win' with blanks, and */
- X/* marks the window to be cleared at next refresh operation. */
- X/****************************************************************/
- X
- Xvoid wclear(win)
- X WINDOW *win;
- X {
- X werase(win);
- X win->_clear = TRUE;
- X } /* wclear */
- X
- X/****************************************************************/
- X/* Clear() fills all lines of stdscr with blanks, and marks */
- X/* marks sdtscr to be cleared at next refresh operation. */
- X/****************************************************************/
- X
- Xvoid clear()
- X {
- X werase(stdscr);
- X stdscr->_clear = TRUE;
- X } /* clear */
- END_OF_FILE
- if test 1578 -ne `wc -c <'winclear.c'`; then
- echo shar: \"'winclear.c'\" unpacked with wrong size!
- fi
- # end of 'winclear.c'
- fi
- if test -f 'windel.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'windel.c'\"
- else
- echo shar: Extracting \"'windel.c'\" \(1534 characters\)
- sed "s/^X//" >'windel.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Delwin() routine of the PCcurses package. */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Max limits off by 1. Fixed thanks to S. Creps: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_windel_rcsid[] = "@(#)windel.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Delwin() deallocates all data allocated by 'win'. If 'win' */
- X/* is a subwindow, it uses the original window's lines for sto- */
- X/* rage, and thus the line arrays are not deallocated. */
- X/****************************************************************/
- X
- Xvoid delwin(win)
- X WINDOW *win;
- X {
- X int i;
- X
- X if (! (win->_flags & _SUBWIN)) /* subwindow uses 'parent's' lines */
- X {
- X for (i = 0; i < win->_maxy && win->_line[i]; i++)
- X free(win->_line[i]);
- X }
- X free(win->_minchng);
- X free(win->_maxchng);
- X free(win->_line);
- X free(win);
- X } /* delwin */
- END_OF_FILE
- if test 1534 -ne `wc -c <'windel.c'`; then
- echo shar: \"'windel.c'\" unpacked with wrong size!
- fi
- # end of 'windel.c'
- fi
- if test -f 'winerase.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'winerase.c'\"
- else
- echo shar: Extracting \"'winerase.c'\" \(1991 characters\)
- sed "s/^X//" >'winerase.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* */
- X/* Erase() routines of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Max limits off by 1. Fixed thanks to S. Creps: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_winerase_rcsid[] = "@(#)winerase.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Werase() fills all lines of window 'win' with blanks and po- */
- X/* sitions the cursor at home in the scroll region. */
- X/****************************************************************/
- X
- Xvoid werase(win)
- X WINDOW *win;
- X {
- X int *end;
- X int *start;
- X short y;
- X static int blank;
- X
- X blank = ' ' | (win->_attrs & ATR_MSK);
- X
- X for (y = win->_regtop; y <= win->_regbottom; y++) /* clear all lines */
- X {
- X start = win->_line[y];
- X end = &start[win->_maxx - 1];
- X while (start <= end) /* clear all line */
- X *start++ = blank;
- X win->_minchng[y] = 0;
- X win->_maxchng[y] = win->_maxx - 1;
- X }
- X win->_cury = win->_regtop; /* cursor home */
- X win->_curx = 0;
- X } /* werase */
- X
- X/****************************************************************/
- X/* Erase() fills all lines of stdscr with blanks and positions */
- X/* the cursor at home in the scroll region. */
- X/****************************************************************/
- X
- Xvoid erase()
- X {
- X werase(stdscr);
- X } /* erase */
- END_OF_FILE
- if test 1991 -ne `wc -c <'winerase.c'`; then
- echo shar: \"'winerase.c'\" unpacked with wrong size!
- fi
- # end of 'winerase.c'
- fi
- if test -f 'winmove.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'winmove.c'\"
- else
- echo shar: Extracting \"'winmove.c'\" \(1366 characters\)
- sed "s/^X//" >'winmove.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Mvwin() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Max limits off by 1. Fixed thanks to S. Creps: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_winmove_rcsid[] = "@(#)winmove.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Mvwin() moves window 'win' to position (begx, begy) on the */
- X/* screen. */
- X/****************************************************************/
- X
- Xint mvwin(win, begy, begx)
- X WINDOW *win;
- X int begy, begx;
- X {
- X if ((begy + win->_maxy) >= (LINES-1) || (begx + win->_maxx) > (COLS-1))
- X return(ERR);
- X win->_begy = begy;
- X win->_begx = begx;
- X touchwin(win);
- X return(OK);
- X } /* mvwin */
- END_OF_FILE
- if test 1366 -ne `wc -c <'winmove.c'`; then
- echo shar: \"'winmove.c'\" unpacked with wrong size!
- fi
- # end of 'winmove.c'
- fi
- if test -f 'winscrol.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'winscrol.c'\"
- else
- echo shar: Extracting \"'winscrol.c'\" \(2093 characters\)
- sed "s/^X//" >'winscrol.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Scroll() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Max limits off by 1. Fixed thanks to S. Creps: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_winscrol_rcsid[] = "@(#)winscrol.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Scroll() scrolls the scrolling region of 'win', but only if */
- X/* scrolling is allowed and if the cursor is inside the scrol- */
- X/* ling region. */
- X/****************************************************************/
- X
- Xvoid scroll(win)
- X WINDOW *win;
- X {
- X int i;
- X int *ptr;
- X int *temp;
- X static int blank;
- X
- X blank = ' ' | (win->_attrs & ATR_MSK);
- X if ( (!win->_scroll) /* check if window scrolls */
- X || (win->_cury < win->_regtop) /* and cursor in region */
- X || (win->_cury > win->_regbottom)
- X )
- X return;
- X
- X temp = win->_line[win->_regtop];
- X for (i = win->_regtop; i < win->_regbottom; i++)
- X {
- X win->_line[i] = win->_line[i+1]; /* re-arrange line pointers */
- X win->_minchng[i] = 0;
- X win->_maxchng[i] = win->_maxx - 1;
- X }
- X for (ptr = temp; ptr - temp < win->_maxx; ptr++)
- X *ptr = blank; /* make a blank line */
- X win->_line[win->_regbottom] = temp;
- X if (win->_cury > win->_regtop) /* if not on top line */
- X win->_cury--; /* cursor scrolls too */
- X win->_minchng[win->_regbottom] = 0;
- X win->_maxchng[win->_regbottom] = win->_maxx - 1;
- X } /* scroll */
- END_OF_FILE
- if test 2093 -ne `wc -c <'winscrol.c'`; then
- echo shar: \"'winscrol.c'\" unpacked with wrong size!
- fi
- # end of 'winscrol.c'
- fi
- if test -f 'wintouch.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'wintouch.c'\"
- else
- echo shar: Extracting \"'wintouch.c'\" \(1410 characters\)
- sed "s/^X//" >'wintouch.c' <<'END_OF_FILE'
- X/****************************************************************/
- X/* Touchwin() routine of the PCcurses package */
- X/* */
- X/****************************************************************/
- X/* This version of curses is based on ncurses, a curses version */
- X/* originally written by Pavel Curtis at Cornell University. */
- X/* I have made substantial changes to make it run on IBM PC's, */
- X/* and therefore consider myself free to make it public domain. */
- X/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
- X/****************************************************************/
- X/* 1.0: Release: 870515 */
- X/* 1.2: Max limits off by 1. Fixed thanks to S. Creps: 881002 */
- X/* 1.3: MSC -W3, Turbo'C' -w -w-pro checkes: 881005 */
- X/****************************************************************/
- X
- X#include <curses.h>
- X#include <curspriv.h>
- X
- Xchar _curses_wintouch_rcsid[] = "@(#)wintouch.c v1.3 - 881005";
- X
- X/****************************************************************/
- X/* Touchwin() marks all lines of window 'win' as changed, from */
- X/* the first to the last character on the line. */
- X/****************************************************************/
- X
- Xvoid touchwin(win)
- X WINDOW *win;
- X {
- X int y;
- X int maxy;
- X int maxx;
- X
- X maxy = win->_maxy - 1;
- X maxx = win->_maxx - 1;
- X
- X for (y = 0; y <= maxy; y++)
- X {
- X win->_minchng[y] = 0;
- X win->_maxchng[y] = maxx;
- X } /* for */
- X } /* touchwin */
- END_OF_FILE
- if test 1410 -ne `wc -c <'wintouch.c'`; then
- echo shar: \"'wintouch.c'\" unpacked with wrong size!
- fi
- # end of 'wintouch.c'
- fi
- echo shar: End of archive 1 \(of 5\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 2 3 4 5 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 5 archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-